<?php
/**
 * 页面控制器
 *
 * @package    app
 * @version    1.0
 * @author     Ray 33705910@qq.com
 * @license    MIT License
 * @copyright  2013 - 2015 Ray
 * @link       http://wangxiaolei.cn
 */

/**
 * 本控制器主要用于：
 * 1.
 * @package  app
 * @extends  Controller
 */
namespace mobile;

class Controller_Index extends Controller_BaseController {

    public $template = "template";

    
    public function before(){
        parent::before();
        //主菜单
        $seller = \Session::get('seller');
        $menu_root = \Model_Category::find($seller->main_menu);
        $menu = $menu_root->children()->get();
        $items = array();
        if($menu){
            $items = \utils\CategoryHandler::get_children($menu);
        }
        $params['nav_menu'] = $items;
        unset($menu_root);

        //底部菜单
        $menu_root = \Model_Category::find($seller->bottom_menu);
        $left_menu = $menu_root->children()->get();

        //组合2-3级菜单
        $items = array();
        if($left_menu){
            $items = \utils\CategoryHandler::get_children($left_menu);
        }
        $params['bottom_menu'] = $items;
        \View::set_global($params);
    }

    public function action_index(){
        $params = array(
            'title' => '首页',
            'menu' => 'mobile',
            'action_name' => '首页',
            'index_title' => '婚姻介绍'
        );

        \View::set_global($params);
        $this->template->content = \View::forge("index/index");    
    }
/*
    public function action_index(){
        $params = array(
            'title' => '首页',
            'menu' => 'INDEX',
        );

        $seller = \Session::get('seller');

        $part_lunbo = $seller->index_lunbo;//图片轮播分类ID

        //图片轮播
        $params['partLunbo'] = \Model_Node::query()
                        ->related(array('category'))
                        ->where('category_id', $part_lunbo)
                        ->get();

        \View::set_global($params);
        $this->template->content = \View::forge("index");
    }*/

}